<template>
  <div>
    <headerTop></headerTop>
    <headerMin></headerMin>
    <!-- 主体 -->
    <div class="promotion">
      <!-- 轮播图 -->
      <div class="banner">
        <el-carousel trigger="click" height="512px">
          <el-carousel-item v-for="(v,i) in banner_List" :key="i">
            <img :src="v.image" alt />
          </el-carousel-item>
        </el-carousel>
      </div>
      <!-- 商品列表 -->
      <div class="goodsList wrap bgw">
        <!-- 商品 -->
        <div  @click="GoDetails(v.id)" v-for="(v,i) in activity_List" :key="i"  class="goodsDetails">
          <img :src="v.goods_img" alt />
          <p class="one">￥{{v.price}}</p>
          <p class="two">>{{v.goods_name}}</p>
          <p class="one">
            评论
            <span>{{v.commentSum}}</span>
            条
          </p>
          <button>立即购买</button>
        </div>
        <!-- 分页 -->
      </div>
    </div>
    <div class="bg1">
      <publicBottom></publicBottom>
    </div>
  </div>
</template>
<script>
import headerTop from "@/components/public/public_headerTop.vue";
import headerMin from "@/components/index/index_header_min";
import publicBottom from "@/components/public/public_bottom";
import { banner } from "@/request/index"; //轮播
import { getActiveGoods } from "@/request/index"; //  活动
export default {
  components: {
    headerTop,
    headerMin,
    publicBottom
  },
  data() {
    return {
      searchState: 0,
      banner_List: [], //轮播图
      activity_List: [] //活动 列表
    };
  },
  created() {
    this.start();
  },
  methods: {
    GoDetails(id) {
      this.$router.push({ path: "goodsDetails?id=" + id });
    },
    start() {
      let shopId = localStorage.getItem("lzyyShopId");
      //  轮播图
      banner({
        position_id: 2
      }).then(res => {
        this.banner_List = res.data;
      });
      //  活动
      getActiveGoods({
        shop_id: shopId
      }).then(res => {
        this.activity_List = res.data.data;
      });
    }
  }
};
</script>
<style lang="less" scoped>
@import "../../assets/less/index";
</style>